package com.qf.common.db.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.common.utils.CommonBeanListUtils;
import org.springframework.beans.BeanUtils;

import java.util.function.Supplier;

public class PageBeanUtils extends CommonBeanListUtils {

    public static <S, T> IPage<T> copyPage(IPage<S> sources, IPage<T> target, Supplier<T> targetSupplier) {
        BeanUtils.copyProperties(sources, target);
        target.setRecords(copyListProperties(sources.getRecords(), targetSupplier));
        return target;
    }
}
